package com.test.bean;

import org.springframework.beans.factory.BeanNameAware;

public class LifeBean implements BeanNameAware {
    private String name;

    public LifeBean() {
        System.out.println("LifeBean()构造函数");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        System.out.println("setName()");
        this.name = name;
    }

    public void init() {
        System.out.println("this is init of Lifebean");
    }

    public void destroy() {
        System.out.println("this is destroy of Lifebean" + this);
    }

    @Override
    public void setBeanName(String name) {
        System.out.println("执行BeanNameAware接口的setBeanName()方法。。。。。");
        this.name = name;
    }
}
